/*
 * File Name: MessageDescriptor.h
 *
 * Created on: 2021-01-28
 * Author: glendy ganby@163.com
 *
 * Last Modified: 2021-01-28
 * Description:
 */

#ifndef _MESSAGEDESCRIPTOR_H_
#define _MESSAGEDESCRIPTOR_H_

#include <string>
#include <vector>
#include <stdint.h>

namespace miniproto
{
class ProtoFieldDescriptor;
class MessageFactory;
class Message;

class MessageDescriptor
{
public:
	typedef ::std::vector< ::miniproto::ProtoFieldDescriptor > ProtoFieldDescriptorList;
public:
	MessageDescriptor();
	virtual ~MessageDescriptor();
	virtual void init() = 0;

	const ::std::string &GetTypeName() const;
	void resize(const int size);
	void set_field_desc(const uint8_t field_type, const ::std::string &field_name, const uint32_t number);
	void set_message_field_desc(const uint8_t field_type, const ::std::string &field_name, const uint32_t number, ::miniproto::Message *message);
	const ::miniproto::ProtoFieldDescriptor *get_field_desc(const int number) const;

protected:
	::std::string type_name_;
	ProtoFieldDescriptorList *field_desc_list_;
};

} // namespace miniproto

#endif //_MESSAGEDESCRIPTOR_H_
